package com.zhao.pojo;

import com.zhao.Handler.ProxyInvocationHandler;
import com.zhao.service.UserService;
import com.zhao.service.UserServiceImpl;

public class Client {
    public static void main(String[] args) {
        //真实角色
//        Host host = new Host();

        UserServiceImpl userService=new UserServiceImpl();

        //代理实例的待用处理程序
        ProxyInvocationHandler pih=new ProxyInvocationHandler();
        pih.setTarget(userService);//将真实角色放置进去
        UserService proxy= (UserService) pih.getProxy();//动态生成对应的代理类！
        proxy.add();
    }
}
